﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="FXFinanceLeaseAdd.aspx.cs" Inherits="IHISCETeim.Web.MachineSys.FXModel.FXFinanceLeaseAdd" %>
<h2 class="contentTitle"  style=" margin-bottom:1px!important;">
    新增融资租赁进度跟踪
</h2>
<div class="pageContent">
	
	<form method="post" action="FXModel/FXFinanceLeaseAdd.aspx?ajaxmethod=add" class="pageForm required-validate" onsubmit="return validateCallback(this, navTabAjaxDone)">
		<div class="pageFormContent" layoutH="92" style=" padding-top:1px!important;">

			 <div class="panel collapse" >
		         <h1 style="color:Red;">
                    进度信息跟进：
                 </h1>
                 <div>
                    <div class="unit">
				          <label>当前进度：</label>
                          <select name="LeaseStatus" class="combox" >
                            <option value="0" selected>IHISCE审核中</option>
                          </select>
			         </div>
                 </div>
            </div>            
			<div class="panel collapse" >
		        <h1>机器及客户信息</h1>
		        <div>
                    <div class="unit">
				        <label>经销商：</label>
				        <input type="text" name="AliasName"   class="required autocomplete" autocompletehref="<%=AutoCompleteRequestUrl %>?ajaxmethod=getagentlist" mustMatch="true" swidth="300" showinputid=""/>
			        </div>
			        <div class="unit">
				        <label>用户：</label>
				        <input type="text"  name="CustomerName"   class="required"/>
			        </div>
                     <div class="unit">
				        <label>联系电话：</label>
				        <input type="text"  name="CustomerMobile"   class="required phone"/>
			        </div>
                    <div class="unit">
				        <label>地址：</label>
				        <input type="text"  name="CustomerAddress"   class=""/>
			        </div>
			        <div class="unit">
				        <label>机型：</label>
                        <%=GetMacType("select","MachineType","")%>
			        </div>
                    <div class="unit">
				        <label>机号：</label>
				        <input type="text"  name="SerialNumber"   class="required"/>
			        </div>
                    <div class="unit">
				        <label>GPS号：</label>
				        <input type="text"  name="GPSNumber"   class=""/>
			        </div>
                   
                </div>
	        </div>	
	        <div style="clear:both;"></div>
            <div class="panel collapse" >
		        <h1>融资租赁信息</h1>
		        <div>
                    <div class="unit">
				        <label>接单日期：</label>
				        <input type="text" name="LOrderDate"   class="date" />
			        </div>
                    <div class="unit">
				        <label>租赁公司：</label>
				        <%=GetLeaseCompany("LeaseCompany", "", "required")%>
			        </div>
                    <div class="unit">
				        <label>售价：</label>
				        <input type="text" name="LTotalPrice" id="FXFinanceLeaseAdd_LTotalPrice"   class="inputFloat required FXFinanceLeaseAdd_ChangeMoney" />
			        </div>
                    <div class="unit">
				        <label>首付比例：</label>
				        <input type="text" name="LowProportion"  id="FXFinanceLeaseAdd_LowProportion" class="inputFloat required FXFinanceLeaseAdd_ChangeMoney" />
                        <span>%</span>
			        </div>
                     <div class="unit">
				        <label>首付金额：</label>
				        <input type="text" name="LDownAmount" id="FXFinanceLeaseAdd_LDownAmount" readonly   class="inputFloat" />
			        </div>
                     <div class="unit">
				        <label>融资额：</label>
				        <input type="text" name="LAmountFinancing" id="FXFinanceLeaseAdd_LAmountFinancing"  readonly   class="inputFloat" />
			        </div>
                    <div class="unit">
				        <label>期限：</label>
				        <input type="text" name="LExpiresYear" id="FXFinanceLeaseAdd_LExpiresYear" value="3"  class="inputFloat required " />
                        <span>(年)</span>
			        </div>
                    <div class="unit" > 
				        <label style=" text-align:right!important;">期数1：</label>
				        <input type="text" name="LExpiresMonth" id="FXFinanceLeaseAdd_LExpiresMonth"  value="36"   class="inputInteger required" />
                        <span>(月)正常的还款期数</span>
			        </div>
                    <div class="unit">
				        <label style=" text-align:right!important;">月租金1：</label>
				        <input type="text" name="LMonthRent"  id="FXFinanceLeaseAdd_LMonthRent" class="inputFloat required" />
                        <span>对应于期数1</span>
			        </div>
                    <div class="unit">
				        <label style=" text-align:right!important;">期数2：</label>
				        <input type="text" name="LExpiresMonth2" id="FXFinanceLeaseAdd_LExpiresMonth2"  value="0"  class="inputInteger required" />
                        <span>(月)如冬季及雨季政策</span>
			        </div>
                    <div class="unit">
				        <label style=" text-align:right!important;">月租金2：</label>
				        <input type="text" name="LMonthRent2" value="0"   class="inputFloat required" />
                        <span>对应于期数2</span>
			        </div>
                    <div class="unit">
				        <label>合同金额：</label>
				        <input type="text" name="LContractAmount"  id="FXFinanceLeaseAdd_LContractAmount"  class="inputFloat required FXFinanceLeaseAdd_ChangeMoney" value="0" />
			        </div>
                    <div class="unit">
				        <label>首付/置换分期申请：</label>
				        <input type="text" name="LByStages"  id="FXFinanceLeaseAdd_LByStages"  class="inputFloat required" value="0" />
			        </div>
                    <div class="unit">
				        <label>应付首付款：</label>
				        <input type="text" name="LPay"  id="FXFinanceLeaseAdd_LPay"   class="inputFloat" />
			        </div>
                    <div class="unit">
				        <label>应付首付款支付状态：</label>
				        <select name="LPayStatus" class="combox"><option value="0">未付</option><option value="1">已付</option><option value="2">无需支付</option></select>
			        </div>
                    <div class="unit">
				        <label>管理费：</label>
				        <input type="text" name="LMFee" id="FXFinanceLeaseAdd_LMFee"  class="required inputFloat" value="" />
			        </div>
                    <div class="unit">
				        <label>管理费支付状态：</label>
				        <select name="LMFeeStatus" class="combox"><option value="0">未付</option><option value="1">已付</option></select>
			        </div>
                </div>
	        </div>	
	        <div style="clear:both;"></div>
            <div class="panel collapse" >
		        <h1>其它信息</h1>
		        <div>
                     <div class="unit">
				        <label>收齐资料日期：</label>
				        <input type="text" name="OGetDate"   class=" date" value="" />
			        </div>
                    <div class="unit">
				        <label>提交资料日期：</label>
				        <input type="text" name="OSubmitDate"   class=" date" value="" />
			        </div>
                    <div class="unit">
				        <label>合同邮寄情况：</label>
				        <input type="text" name="OContractPost"   class="" value="" />
			        </div>
                    <div class="unit">
				        <label>投保情况：</label>
				        <select name="OInsureStatus" class="combox"><option value="0">未投保</option><option value="1">已投保</option></select>
			        </div>
                    <div class="unit">
				        <label>备注说明：</label>
                        <textarea name="ORemark" cols="50" rows="10" ></textarea>
			        </div>
                </div>
	        </div>	
	        <div style="clear:both;"></div>
		</div>
		<div class="formBar">
			<ul>
				<li><div class="buttonActive"><div class="buttonContent"><button type="submit">提交</button></div></div></li>
				<li><div class="button"><div class="buttonContent"><button type="button" class="close" onclick="FXFinanceLeaseMasterList_Close();">关闭</button></div></div></li>
			</ul>
		</div>
	</form>
	
</div>


<script type="text/javascript" >
    $(document).ready(function () {
        //自动计算
        //1.
        $(".FXFinanceLeaseAdd_ChangeMoney").blur(function () {
            FXFinanceLeaseAdd_ChangeMoney();
        })

        $("#FXFinanceLeaseAdd_LExpiresYear").blur(function () {
            //期限（年）
            var $LExpiresYear = $(this);
            //期数1
            var $LExpiresMonth = $("#FXFinanceLeaseAdd_LExpiresMonth");
            //期数2
            var $LExpiresMonth2 = $("#FXFinanceLeaseAdd_LExpiresMonth2");

            $LExpiresMonth.val($LExpiresYear.val() * 12);
            $LExpiresMonth2.val(0);
            FXFinanceLeaseAdd_ChangeMoney();
        })

        $("#FXFinanceLeaseAdd_LExpiresMonth").blur(function () {
            //期限（年）
            var $LExpiresYear = $("#FXFinanceLeaseAdd_LExpiresYear");
            //期数1
            var $LExpiresMonth = $("#FXFinanceLeaseAdd_LExpiresMonth");
            //期数2
            var $LExpiresMonth2 = $("#FXFinanceLeaseAdd_LExpiresMonth2");

           
            $LExpiresMonth2.val(parseFloat($LExpiresYear.val()) * 12 - parseFloat($LExpiresMonth.val()))
        })
    })

    function FXFinanceLeaseAdd_ChangeMoney() {
        //alert(1)
        //售价
        var $LTotalPrice = $("#FXFinanceLeaseAdd_LTotalPrice");
        //首付比例%
        var $LowProportion = $("#FXFinanceLeaseAdd_LowProportion");
        //首付金额
        var $LDownAmount = $("#FXFinanceLeaseAdd_LDownAmount");
        //融资额
        var $LAmountFinancing = $("#FXFinanceLeaseAdd_LAmountFinancing");
        //期限（年）
        var $LExpiresYear = $("#FXFinanceLeaseAdd_LExpiresYear");
        //期数1
        var $LExpiresMonth = $("#FXFinanceLeaseAdd_LExpiresMonth");
        //期数2
        var $LExpiresMonth2 = $("#FXFinanceLeaseAdd_LExpiresMonth2");

        //合同金额
        var $LContractAmount = $("#FXFinanceLeaseAdd_LContractAmount");
        //应付首付款
        var $LPay = $("#FXFinanceLeaseAdd_LPay");
        //管理费
        var $LMFee = $("#FXFinanceLeaseAdd_LMFee");


        $LDownAmount.val($LTotalPrice.val() * $LowProportion.val() / 100);
        $LAmountFinancing.val($LTotalPrice.val() - $LDownAmount.val());
        //$LPay.val(($LContractAmount.val() - $LAmountFinancing.val()) < 0 ? "0" : ($LContractAmount.val() - $LAmountFinancing.val()));

        var $rate = 0;  //$LExpiresYear.val() == 1 ? 1.6:$LExpiresYear.val() == 2?2.6:3.6;
        
        switch ( parseFloat( $LExpiresYear.val())) {
            case 1:
                $rate = 1.6;
                break;
            case 1.5:
                $rate = 2.0;
                break;
            case 2:
                $rate = 2.6;
                break;
            case 2.5:
                $rate = 3.2;
                break;
            case 3:
                $rate = 3.6;
                break;
            default:
                $rate = 3.6;
                break;

        }

        //$LMFee.val($LTotalPrice.val() * $rate / 100);
        //期数处理
       
        if ((parseFloat($LExpiresMonth.val()) + parseFloat($LExpiresMonth2.val())) != parseFloat($LExpiresYear.val()) * 12)
            alert("期数之和不对，请确认");
    }

</script>